package com.ruoyi.param.utils;

import com.ruoyi.param.domain.TparamTp;

import java.time.LocalDate;

public class TpTimeUtil {

    public static String[] time(TparamTp tparamTp) {
        String closeTime = "", openTime = "";
        String sdtState = "", edtState = "";
        LocalDate now = LocalDate.now();
        switch (now.getDayOfWeek().getValue()) {
            case 1: {
                closeTime = tparamTp.getSdt1();
                openTime = tparamTp.getEdt1();
                sdtState = String.valueOf(tparamTp.getSdt1State());
                edtState = String.valueOf(tparamTp.getEdt1State());
            }
            break;
            case 2: {
                closeTime = tparamTp.getSdt2();
                openTime = tparamTp.getEdt2();
                sdtState = String.valueOf(tparamTp.getSdt2State());
                edtState = String.valueOf(tparamTp.getEdt2State());
            }
            break;
            case 3: {
                closeTime = tparamTp.getSdt3();
                openTime = tparamTp.getEdt3();
                sdtState = String.valueOf(tparamTp.getSdt3State());
                edtState = String.valueOf(tparamTp.getEdt3State());
            }
            break;
            case 4: {
                closeTime = tparamTp.getSdt4();
                openTime = tparamTp.getEdt4();
                sdtState = String.valueOf(tparamTp.getSdt4State());
                edtState = String.valueOf(tparamTp.getEdt4State());
            }
            break;
            case 5: {
                closeTime = tparamTp.getSdt5();
                openTime = tparamTp.getEdt5();
                sdtState = String.valueOf(tparamTp.getSdt5State());
                edtState = String.valueOf(tparamTp.getEdt5State());
            }
            break;
            case 6: {
                closeTime = tparamTp.getSdt6();
                openTime = tparamTp.getEdt6();
                sdtState = String.valueOf(tparamTp.getSdt6State());
                edtState = String.valueOf(tparamTp.getEdt6State());
            }
            break;
            case 7: {
                closeTime = tparamTp.getSdt7();
                openTime = tparamTp.getEdt7();
                sdtState = String.valueOf(tparamTp.getSdt7State());
                edtState = String.valueOf(tparamTp.getEdt7State());
            }
            break;
        }
        return new String[]{closeTime, openTime, sdtState, edtState};
    }
}
